import { useEffect, useState } from "react";
// import http from "../../../utils/http";
import { ratedApi } from "../../../utils/api";

const Movies = () => {
  const [ratedList, setRatedList] = useState([]);

  useEffect(() => {
    // axios.get("http://www.pudge.wang:3080/api/rated/list").then((response) => {
    //   setRatedList(response.data.result);
    // });
    (async () => {
      try {
        const res = await ratedApi({
          a: 3,
          b: 4,
        });
        setRatedList(res.result);
      } catch (err) {
        console.log("请求出错");
      }
      //  finally {
      //   console.log()
      // }
    })();
  }, []);

  return (
    <>
      <div>这是电影页面</div>
      <ul>
        {ratedList.map((item) => (
          <li key={item._id}>{item.title}</li>
        ))}
      </ul>
    </>
  );
};

export default Movies;
